package com.naiterui.ehp.bs.agent.controller;

import com.naiterui.common.repository.page.PageParamVO;
import com.naiterui.common.repository.page.PageVO;
import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bs.agent.service.INoticeService;
import com.naiterui.ehp.bs.agent.vo.NoticeItemVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 客户管理
 * 
 * @author yangfuya
 * @since 2022/2/15
 */
@Slf4j
@Api(tags = {SwaggerTag.AGENT + "消息管理"})
@RequiredArgsConstructor
@RestController
@RequestMapping("/notice")
public class NoticeController {
    private final INoticeService noticeService;

    @GetMapping("/list")
    @ApiOperation("查询消息列表")
    public PageVO<NoticeItemVO> pageList(@RequestHeader Long agentId, PageParamVO pageParamVO) {
        return noticeService.findNoticePage(agentId, pageParamVO);
    }
    @GetMapping("/last/get")
    @ApiOperation("最后一条消息")
    public NoticeItemVO getLastNotice(@RequestHeader Long agentId) {
        return noticeService.getLastNotice(agentId);
    }
}
